diff --git a/js/identityWallet/identityWallet.d.ts b/js/identityWallet/identityWallet.d.ts index 2f5c3d51..cdaae040 100644 --- a/js/identityWallet/identityWallet.d.ts +++ b/js/identityWallet/identityWallet.d.ts @@ -43,12 +43,14 @@ export declare class IdentityWallet { private createMessage; private makeReq; private makeRes; + private messageCannonicaliser; getPublicKeys: (encryptionPass: string) => PublicKeyMap; private initializeAndSign; validateJWT(receivedJWT: JSONWebToken, sentJWT?: JSONWebToken, customRegistry?: IRegistry): Promise; asymEncrypt: (data: Buffer, publicKey: Buffer) => Promise; asymEncryptToDidKey: (data: Buffer, keyRef: string, customRegistry?: IRegistry) => Promise; asymDecrypt: (data: string, decryptionKeyArgs: IKeyDerivationArgs) => Promise; + sign: (data: Buffer, pass: string) => Buffer; private sendTransaction; transactions: { sendTransaction: (request: ITransactionEncodable, pass: string) => Promise; @@ -64,17 +66,17 @@ export declare class IdentityWallet { }, pass: string, recieved?: JSONWebToken) => Promise>; interactionTokens: { request: { - auth: ({ expires, aud, ...message }: WithExtraOptions>, pass: string) => Promise>, "description" | "callbackURL">>>; - offer: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise, "callbackURL" | "offeredCredentials">>>; - share: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise, "callbackURL" | "credentialRequirements">>>; - payment: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise, "description" | "transactionOptions" | "callbackURL">>>; + auth: ({ expires, aud, ...message }: WithExtraOptions>, pass: string) => Promise>; + offer: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise>; + share: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise>; + payment: ({ expires, aud, ...message }: WithExtraOptions, pass: string) => Promise>; }; response: { - auth: ({ expires, aud, ...message }: WithExtraOptions>, pass: string, recieved?: JSONWebToken) => Promise>, "description" | "callbackURL">>>; - offer: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise, "callbackURL" | "selectedCredentials">>>; - share: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise, "callbackURL" | "suppliedCredentials">>>; - issue: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise, "signedCredentials">>>; - payment: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise, "txHash">>>; + auth: ({ expires, aud, ...message }: WithExtraOptions>, pass: string, recieved?: JSONWebToken) => Promise>; + offer: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise>; + share: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise>; + issue: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise>; + payment: ({ expires, aud, ...message }: WithExtraOptions, pass: string, recieved?: JSONWebToken) => Promise>; }; }; }; diff --git a/ts/identityWallet/identityWallet.ts b/ts/identityWallet/identityWallet.ts index 2259accb..da299efe 100644 --- a/ts/identityWallet/identityWallet.ts +++ b/ts/identityWallet/identityWallet.ts @@ -481,6 +481,20 @@ export class IdentityWallet { decryptionKeyArgs: IKeyDerivationArgs, ) => this.vaultedKeyProvider.asymDecrypt(data, decryptionKeyArgs) + /** + * Signs the data with the identity key + * @param data - The data to sign + * @param pass - the password + */ + public sign = (data: Buffer, pass: string) => + this.vaultedKeyProvider.sign( + { + derivationPath: KeyTypes.jolocomIdentityKey, + encryptionPass: pass, + }, + data, + ) + private sendTransaction = async ( request: ITransactionEncodable, pass: string,