@0xpass/passport
Advanced tools
Comparing version 2.0.4 to 2.0.5
# @0xpass/passport | ||
## 2.0.5 | ||
### Patch Changes | ||
- c3ad73a: Keysigner viem client compatibility | ||
## 2.0.4 | ||
@@ -4,0 +10,0 @@ |
@@ -52,2 +52,11 @@ import { AuthenticationParams, AuthenticationResponse, DelegatedRegisterAccountParams, DelegatedRegisterAccountResponse, LambaCallParams, LambdaNewParams, Method, NewScopeParams, NewScopeResponse, RegistrationParams, RegistrationResponse, RpcHeaders, RpcMethodParams, SignMessageParams, SignMessageResponse, SignTransactionParams, SignTransactionResponse, UpdateScopeParams, UpdateScopeResponse } from "./types"; | ||
/** | ||
* Gets authenticated headers for a request. | ||
*/ | ||
getDelegatedAuthenticatedHeaders(): Promise<{ | ||
[x: string]: string; | ||
"X-Encrypted-User": string; | ||
"X-Encrypted-Key": string; | ||
"X-Scope-Id": string; | ||
}>; | ||
/** | ||
* Gets account address from the passport node. | ||
@@ -54,0 +63,0 @@ */ |
@@ -367,2 +367,21 @@ import axios from 'axios'; | ||
/** | ||
* Gets authenticated headers for a request. | ||
*/ | ||
async getDelegatedAuthenticatedHeaders() { | ||
if (!this.userData) { | ||
throw new Error("User data must be set before proceeding."); | ||
} | ||
const encrypted_user = await aesEncrypt(JSON.stringify(this.userData), this.aesKey); | ||
const signature = await this.signer.sign(encrypted_user); | ||
const encrypted_signature = await aesEncrypt(JSON.stringify(signature), this.aesKey); | ||
const header = this.signer.getHeaderName(); | ||
const headers = { | ||
"X-Encrypted-User": encrypted_user, | ||
"X-Encrypted-Key": this.encryptedAesKey, | ||
"X-Scope-Id": this.scopeId, | ||
[header]: encrypted_signature, | ||
}; | ||
return headers; | ||
} | ||
/** | ||
* Gets account address from the passport node. | ||
@@ -369,0 +388,0 @@ */ |
{ | ||
"name": "@0xpass/passport", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,3 +29,3 @@ import axios from "axios"; | ||
import { SignerWithOptionalCreator } from "./types/credential"; | ||
import { CredentialCreator, KeyAssertion } from "@0xpass/models"; | ||
import { CredentialCreator } from "@0xpass/models"; | ||
import { | ||
@@ -181,2 +181,26 @@ aesDecrypt, | ||
/** | ||
* Gets authenticated headers for a request. | ||
*/ | ||
public async getDelegatedAuthenticatedHeaders() { | ||
if (!this.userData) { | ||
throw new Error("User data must be set before proceeding."); | ||
} | ||
const encrypted_user = await aesEncrypt(JSON.stringify(this.userData), this.aesKey); | ||
const signature = await this.signer.sign(encrypted_user); | ||
const encrypted_signature = await aesEncrypt(JSON.stringify(signature), this.aesKey); | ||
const header: SignatureHeader = this.signer.getHeaderName() as SignatureHeader; | ||
const headers = { | ||
"X-Encrypted-User": encrypted_user, | ||
"X-Encrypted-Key": this.encryptedAesKey, | ||
"X-Scope-Id": this.scopeId, | ||
[header]: encrypted_signature, | ||
}; | ||
return headers; | ||
} | ||
/** | ||
* Gets account address from the passport node. | ||
@@ -183,0 +207,0 @@ */ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89337
1929