@lit-protocol/wrapped-keys
Advanced tools
Comparing version 6.6.0 to 6.6.1-beta.1
@@ -26,3 +26,3 @@ { | ||
}, | ||
"version": "6.6.0", | ||
"version": "6.6.1-beta.1", | ||
"dependencies": { | ||
@@ -39,17 +39,15 @@ "@ethersproject/abstract-provider": "5.7.0", | ||
"pako": "1.0.11", | ||
"punycode": "2.3.1", | ||
"siwe": "^2.0.5", | ||
"uint8arrays": "^4.0.3", | ||
"util": "0.12.5", | ||
"@lit-protocol/bls-sdk": "6.6.0", | ||
"@lit-protocol/constants": "6.6.0", | ||
"@lit-protocol/crypto": "6.6.0", | ||
"@lit-protocol/ecdsa-sdk": "6.6.0", | ||
"@lit-protocol/encryption": "6.6.0", | ||
"@lit-protocol/logger": "6.6.0", | ||
"@lit-protocol/misc": "6.6.0", | ||
"@lit-protocol/nacl": "6.6.0", | ||
"@lit-protocol/sev-snp-utils-sdk": "6.6.0", | ||
"@lit-protocol/types": "6.6.0", | ||
"@lit-protocol/uint8arrays": "6.6.0", | ||
"@lit-protocol/bls-sdk": "6.6.1-beta.1", | ||
"@lit-protocol/constants": "6.6.1-beta.1", | ||
"@lit-protocol/crypto": "6.6.1-beta.1", | ||
"@lit-protocol/ecdsa-sdk": "6.6.1-beta.1", | ||
"@lit-protocol/encryption": "6.6.1-beta.1", | ||
"@lit-protocol/logger": "6.6.1-beta.1", | ||
"@lit-protocol/misc": "6.6.1-beta.1", | ||
"@lit-protocol/nacl": "6.6.1-beta.1", | ||
"@lit-protocol/sev-snp-utils-sdk": "6.6.1-beta.1", | ||
"@lit-protocol/types": "6.6.1-beta.1", | ||
"@lit-protocol/uint8arrays": "6.6.1-beta.1", | ||
"tslib": "1.14.1" | ||
@@ -56,0 +54,0 @@ }, |
@@ -25,3 +25,2 @@ "use strict"; | ||
}); | ||
console.log('fetched metadata', storedKeyMetadata); | ||
const allowPkpAddressToDecrypt = (0, utils_2.getPkpAccessControlCondition)(storedKeyMetadata.pkpAddress); | ||
@@ -28,0 +27,0 @@ const { litActionCode, litActionIpfsCid } = (0, utils_1.getLitActionCodeOrCid)(network, 'signMessage'); |
@@ -15,2 +15,3 @@ "use strict"; | ||
const { litNetwork, sessionSig } = params; | ||
const requestId = (0, utils_1.generateRequestId)(); | ||
const { baseUrl, initParams } = (0, utils_1.getBaseRequestParams)({ | ||
@@ -20,2 +21,3 @@ litNetwork, | ||
method: 'GET', | ||
requestId, | ||
}); | ||
@@ -26,2 +28,3 @@ const pkpAddress = (0, utils_2.getPkpAddressFromSessionSig)(sessionSig); | ||
init: initParams, | ||
requestId, | ||
}); | ||
@@ -38,2 +41,3 @@ } | ||
const { litNetwork, sessionSig, id } = params; | ||
const requestId = (0, utils_1.generateRequestId)(); | ||
const { baseUrl, initParams } = (0, utils_1.getBaseRequestParams)({ | ||
@@ -43,2 +47,3 @@ litNetwork, | ||
method: 'GET', | ||
requestId, | ||
}); | ||
@@ -49,2 +54,3 @@ const pkpAddress = (0, utils_2.getPkpAddressFromSessionSig)(sessionSig); | ||
init: initParams, | ||
requestId, | ||
}); | ||
@@ -60,2 +66,3 @@ } | ||
const { litNetwork, sessionSig, storedKeyMetadata } = params; | ||
const requestId = (0, utils_1.generateRequestId)(); | ||
const { baseUrl, initParams } = (0, utils_1.getBaseRequestParams)({ | ||
@@ -65,2 +72,3 @@ litNetwork, | ||
method: 'POST', | ||
requestId, | ||
}); | ||
@@ -73,2 +81,3 @@ const { pkpAddress, id } = await (0, utils_1.makeRequest)({ | ||
}, | ||
requestId, | ||
}); | ||
@@ -75,0 +84,0 @@ return { pkpAddress, id }; |
@@ -19,3 +19,4 @@ import { AuthSig, LIT_NETWORKS_KEYS } from '@lit-protocol/types'; | ||
litNetwork: LIT_NETWORKS_KEYS; | ||
requestId: string; | ||
} | ||
export {}; |
@@ -6,5 +6,7 @@ import { BaseRequestParams } from './types'; | ||
}; | ||
export declare function makeRequest<T>({ url, init, }: { | ||
export declare function generateRequestId(): string; | ||
export declare function makeRequest<T>({ url, init, requestId, }: { | ||
url: string; | ||
init: RequestInit; | ||
requestId: string; | ||
}): Promise<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.makeRequest = exports.getBaseRequestParams = void 0; | ||
exports.makeRequest = exports.generateRequestId = exports.getBaseRequestParams = void 0; | ||
const uint8arrays_1 = require("@lit-protocol/uint8arrays"); | ||
@@ -37,2 +37,3 @@ const constants_1 = require("./constants"); | ||
headers: { | ||
'x-correlation-id': requestParams.requestId, | ||
'Content-Type': 'application/json', | ||
@@ -85,19 +86,26 @@ 'Lit-Network': litNetwork, | ||
} | ||
async function makeRequest({ url, init, }) { | ||
console.log('Fetching from URL', url); | ||
const response = await fetch(url, { ...init }); | ||
if (!response.ok) { | ||
const errorMessage = await getResponseErrorMessage(response); | ||
throw new Error(`Failed to make request for wrapped key: ${errorMessage}`); | ||
function generateRequestId() { | ||
return Math.random().toString(16).slice(2); | ||
} | ||
exports.generateRequestId = generateRequestId; | ||
async function makeRequest({ url, init, requestId, }) { | ||
try { | ||
const response = await fetch(url, { ...init }); | ||
if (!response.ok) { | ||
const errorMessage = await getResponseErrorMessage(response); | ||
throw new Error(`HTTP(${response.status}): ${errorMessage}`); | ||
} | ||
const result = await getResponseJson(response); | ||
if (typeof result === 'string') { | ||
throw new Error(`HTTP(${response.status}): ${result}`); | ||
} | ||
return result; | ||
} | ||
/** | ||
* | ||
*/ | ||
const result = await getResponseJson(response); | ||
if (typeof result === 'string') { | ||
throw new Error(`Unexpected response from wrapped key service: ${result}`); | ||
catch (e) { | ||
throw new Error(`Request(${requestId}) for wrapped key failed. Error: ${e.message | ||
// @ts-expect-error Unknown, but `cause` is on `TypeError: fetch failed` errors | ||
}${e.cause ? ' - ' + e.cause : ''}`); | ||
} | ||
return result; | ||
} | ||
exports.makeRequest = makeRequest; | ||
//# sourceMappingURL=utils.js.map |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
100179
24
1451
1
1
+ Added@lit-protocol/bls-sdk@6.6.1-beta.1(transitive)
+ Added@lit-protocol/constants@6.6.1-beta.1(transitive)
+ Added@lit-protocol/crypto@6.6.1-beta.1(transitive)
+ Added@lit-protocol/ecdsa-sdk@6.6.1-beta.1(transitive)
+ Added@lit-protocol/encryption@6.6.1-beta.1(transitive)
+ Added@lit-protocol/logger@6.6.1-beta.1(transitive)
+ Added@lit-protocol/misc@6.6.1-beta.1(transitive)
+ Added@lit-protocol/nacl@6.6.1-beta.1(transitive)
+ Added@lit-protocol/sev-snp-utils-sdk@6.6.1-beta.1(transitive)
+ Added@lit-protocol/types@6.6.1-beta.1(transitive)
+ Added@lit-protocol/uint8arrays@6.6.1-beta.1(transitive)
- Removedpunycode@2.3.1
- Removeduint8arrays@^4.0.3
- Removed@lit-protocol/bls-sdk@6.6.0(transitive)
- Removed@lit-protocol/constants@6.6.0(transitive)
- Removed@lit-protocol/crypto@6.6.0(transitive)
- Removed@lit-protocol/ecdsa-sdk@6.6.0(transitive)
- Removed@lit-protocol/encryption@6.6.0(transitive)
- Removed@lit-protocol/logger@6.6.0(transitive)
- Removed@lit-protocol/misc@6.6.0(transitive)
- Removed@lit-protocol/nacl@6.6.0(transitive)
- Removed@lit-protocol/sev-snp-utils-sdk@6.6.0(transitive)
- Removed@lit-protocol/types@6.6.0(transitive)
- Removed@lit-protocol/uint8arrays@6.6.0(transitive)
- Removedmultiformats@12.1.3(transitive)
- Removeduint8arrays@4.0.10(transitive)