UNPKG

8.38 kBTypeScriptView Raw
1import { IonicNativePlugin } from '@ionic-native/core';
2export interface IntelSecurityDataOptions {
3 data: String;
4 /** Tag text. */
5 tag?: String;
6 /** Valid secure data instance ID. */
7 extraKey?: Number;
8 /** Application access control policy. */
9 appAccessControl?: Number;
10 /** Device locality policy. */
11 deviceLocality?: Number;
12 /** Sensitivity level policy. */
13 sensitivityLevel?: Number;
14 /** Disallow sealed blob access. */
15 noStore?: Boolean;
16 /** Disallow plain-text data access. */
17 noRead?: Boolean;
18 /** Creator unique ID. */
19 creator?: Number;
20 /** Array of owners unique IDs. */
21 owners?: Number[];
22 /** List of trusted web domains. */
23 webOwners?: String[];
24}
25/**
26 * @name Intel Security
27 * @description
28 * The App Security API enables the use of security properties and capabilities on the platform, using a new set of API defined for application developers. You are not required to be a security expert to make good use of the API. Key elements, such as encryption of data and establishments of capabilities, is abstracted and done by the API implementation, for you.
29 *
30 * For example:
31 * - Use the API to store (E.g. cache) data locally, using the device non-volatile storage. Data protection/encryption will be done for you by the API implementation
32 * - Establish a connection with remote server (E.g. XHR) using a protected channel. SSL/TLS establishment and usage will be done for you by the API implementation
33 *
34 * For more information please visit the [API documentation](https://software.intel.com/en-us/app-security-api/api).
35 *
36 * @usage
37 * ```typescript
38 * import { IntelSecurity } from '@ionic-native/intel-security/ngx';
39 * ...
40 * constructor(private intelSecurity: IntelSecurity) { }
41 * ...
42 *
43 * let storageID = 'id';
44 *
45 * this.intelSecurity.data.createFromData({ data: 'Sample Data' })
46 * .then((instanceID: Number) => this.intelSecurity.storage.write({ id: storageId, instanceID: instanceID }))
47 * .catch((error: any) => console.log(error));
48 *
49 * this.intelSecurity.storage.read({id: storageID })
50 * .then((instanceID: number) => this.intelSecurity.data.getData(instanceID))
51 * .then((data: string) => console.log(data)) // Resolves to 'Sample Data'
52 * .catch((error: any) => console.log(error));
53 *
54 * this.intelSecurity.storage.delete({ id: storageID })
55 * .then(() => console.log('Deleted Successfully'))
56 * .catch((error: any) => console.log(error));
57 * ```
58 * @classes
59 * IntelSecurityData
60 * IntelSecurityStorage
61 * @interfaces
62 * IntelSecurityDataOptions
63 */
64export declare class IntelSecurityOriginal extends IonicNativePlugin {
65 /**
66 * returns an IntelSecurityStorage object
67 * @type {IntelSecurityStorage}
68 */
69 storage: IntelSecurityStorage;
70 /**
71 * Returns an IntelSecurityData object
72 * @type {IntelSecurityData}
73 */
74 data: IntelSecurityData;
75}
76/**
77 * @hidden
78 */
79export declare class IntelSecurityData {
80 /**
81 * This creates a new instance of secure data using plain-text data.
82 * @param options {IntelSecurityDataOptions}
83 * @returns {Promise<any>} Returns a Promise that resolves with the instanceID of the created data instance, or rejects with an error.
84 */
85 createFromData(options: IntelSecurityDataOptions): Promise<Number>;
86 /**
87 * This creates a new instance of secure data (using sealed data)
88 * @param options {Object}
89 * @param options.sealedData {string} Sealed data in string format.
90 * @returns {Promise<any>} Returns a Promise that resolves with the instanceID of the created data instance, or rejects with an error.
91 */
92 createFromSealedData(options: {
93 sealedData: string;
94 }): Promise<Number>;
95 /**
96 * This returns the plain-text data of the secure data instance.
97 * @param instanceID {Number} Secure data instance ID.
98 * @returns {Promise<string>} Returns a Promise that resolves to the data as plain-text, or rejects with an error.
99 */
100 getData(instanceID: Number): Promise<string>;
101 /**
102 * This returns the sealed chunk of a secure data instance.
103 * @param instanceID {any} Secure data instance ID.
104 * @returns {Promise<any>} Returns a Promise that resolves to the sealed data, or rejects with an error.
105 */
106 getSealedData(instanceID: any): Promise<any>;
107 /**
108 * This returns the tag of the secure data instance.
109 * @param instanceID {any} Secure data instance ID.
110 * @returns {Promise<string>} Returns a Promise that resolves to the tag, or rejects with an error.
111 */
112 getTag(instanceID: any): Promise<string>;
113 /**
114 * This returns the data policy of the secure data instance.
115 * @param instanceID {any} Secure data instance ID.
116 * @returns {Promise<any>} Returns a promise that resolves to the policy object, or rejects with an error.
117 */
118 getPolicy(instanceID: any): Promise<any>;
119 /**
120 * This returns an array of the data owners unique IDs.
121 * @param instanceID {any} Secure data instance ID.
122 * @returns {Promise<Array>} Returns a promise that resolves to an array of owners' unique IDs, or rejects with an error.
123 */
124 getOwners(instanceID: any): Promise<any[]>;
125 /**
126 * This returns the data creator unique ID.
127 * @param instanceID {any} Secure data instance ID.
128 * @returns {Promise<Number>} Returns a promsie that resolves to the creator's unique ID, or rejects with an error.
129 */
130 getCreator(instanceID: any): Promise<Number>;
131 /**
132 * This returns an array of the trusted web domains of the secure data instance.
133 * @param instanceID {any} Secure data instance ID.
134 * @returns {Promise<Array>} Returns a promise that resolves to a list of web owners, or rejects with an error.
135 */
136 getWebOwners(instanceID: any): Promise<any[]>;
137 /**
138 * This changes the extra key of a secure data instance. To successfully replace the extra key, the calling application must have sufficient access to the plain-text data.
139 * @param options {Object}
140 * @param options.instanceID {any} Secure data instance ID.
141 * @param options.extraKey {Number} Extra sealing secret for secure data instance.
142 * @returns {Promise<any>} Returns a promise that resolves with no parameters, or rejects with an error.
143 */
144 changeExtraKey(options: any): Promise<any>;
145 /**
146 * This releases a secure data instance.
147 * @param instanceID {any} Secure data instance ID.
148 * @returns {Promise<any>} Returns a promise that resovles with no parameters, or rejects with an error.
149 */
150 destroy(instanceID: any): Promise<any>;
151}
152/**
153 * @hidden
154 */
155export declare class IntelSecurityStorage {
156 /**
157 * This deletes a secure storage resource (indicated by id).
158 * @param options {Object}
159 * @param options.id {String} Storage resource identifier.
160 * @param [options.storageType] {Number} Storage type.
161 * @returns {Promise<any>} Returns a Promise that resolves with no parameters, or rejects with an error.
162 */
163 delete(options: {
164 id: string;
165 storageType?: Number;
166 }): Promise<any>;
167 /**
168 * This reads the data from secure storage (indicated by id) and creates a new secure data instance.
169 * @param options {Object}
170 * @param options.id {String} Storage resource identifier.
171 * @param [options.storageType] {Number} Storage type.
172 * @param [options.extraKey] {Number} Valid secure data instance ID.
173 * @returns {Promise<Number>} Returns a Promise that resolves with the instance ID of the created secure data instance, or rejects with an error.
174 */
175 read(options: {
176 id: string;
177 storageType?: Number;
178 extraKey?: Number;
179 }): Promise<Number>;
180 /**
181 * This writes the data contained in a secure data instance into secure storage.
182 * @param options {Object}
183 * @param options.id {String} Storage resource identifier.
184 * @param options.instanceID {Number} Valid secure data instance ID
185 * @param [options.storageType] {Number} Storage type.
186 * @returns {Promise<any>} Returns a Promise that resolves with no parameters, or rejects with an error.
187 */
188 write(options: {
189 id: String;
190 instanceID: Number;
191 storageType?: Number;
192 }): Promise<any>;
193}
194
195export declare const IntelSecurity: IntelSecurityOriginal;
\No newline at end of file