gdc-sdk-node-ts 2.4.33 → 2.4.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -113,6 +113,8 @@ If you need the shortest path:
|
|
|
113
113
|
|
|
114
114
|
- main onboarding guide:
|
|
115
115
|
[docs/101-SDK_END_TO_END.md](./docs/101-SDK_END_TO_END.md)
|
|
116
|
+
- wallet `context`, stable `runtimeId` and KMS-encrypted seed custody:
|
|
117
|
+
[docs/101-WALLET_CONTEXT_AND_KEY_CUSTODY.md](./docs/101-WALLET_CONTEXT_AND_KEY_CUSTODY.md)
|
|
116
118
|
- first public actor surfaces:
|
|
117
119
|
`HostOnboardingSdk`, `OrganizationControllerSdk`,
|
|
118
120
|
`IndividualControllerSdk`, `ProfessionalSdk`
|
|
@@ -76,10 +76,12 @@ export declare class NodeManagedWallet implements IWallet {
|
|
|
76
76
|
* representative; these runtime keys protect DIDComm communications.
|
|
77
77
|
*
|
|
78
78
|
* The caller owns durable wallet custody. When deterministic provisioning is
|
|
79
|
-
* used, protect `seedMaterial` in the portal wallet store (for example
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* used, protect `seedMaterial` in the portal wallet store (for example with
|
|
80
|
+
* its KMS/KEK and optionally a user PIN) and persist the same non-secret
|
|
81
|
+
* `context.runtime.runtimeId`. A fresh `NodeManagedWallet` reconstructs the
|
|
82
|
+
* same private keys from that seed and context after restart, so private JWKs
|
|
83
|
+
* do not need separate persistence. ICA and GW receive only this returned
|
|
84
|
+
* public JWKS.
|
|
83
85
|
*/
|
|
84
86
|
initializeCommunicationJsonWebKeySet(context: WalletExecutionContext, options?: NodeCommunicationWalletInitialization): Promise<JwkSet>;
|
|
85
87
|
/**
|
|
@@ -143,10 +143,12 @@ export class NodeManagedWallet {
|
|
|
143
143
|
* representative; these runtime keys protect DIDComm communications.
|
|
144
144
|
*
|
|
145
145
|
* The caller owns durable wallet custody. When deterministic provisioning is
|
|
146
|
-
* used, protect `seedMaterial` in the portal wallet store (for example
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
146
|
+
* used, protect `seedMaterial` in the portal wallet store (for example with
|
|
147
|
+
* its KMS/KEK and optionally a user PIN) and persist the same non-secret
|
|
148
|
+
* `context.runtime.runtimeId`. A fresh `NodeManagedWallet` reconstructs the
|
|
149
|
+
* same private keys from that seed and context after restart, so private JWKs
|
|
150
|
+
* do not need separate persistence. ICA and GW receive only this returned
|
|
151
|
+
* public JWKS.
|
|
150
152
|
*/
|
|
151
153
|
async initializeCommunicationJsonWebKeySet(context, options = {}) {
|
|
152
154
|
if (!context.runtime?.runtimeId) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VerifiableCredentialV2 } from 'gdc-common-utils-ts/models/verifiable-credential';
|
|
2
|
+
import type { IWallet, WalletExecutionContext, WalletKeySelection } from 'gdc-sdk-core-ts';
|
|
3
|
+
/** Input required to add one human-authorizer proof to the out-of-band VC. */
|
|
4
|
+
export type SignOrganizationRegistrationAuthorizationInput = Readonly<{
|
|
5
|
+
credential: VerifiableCredentialV2;
|
|
6
|
+
wallet: IWallet;
|
|
7
|
+
context: WalletExecutionContext;
|
|
8
|
+
key: WalletKeySelection;
|
|
9
|
+
verificationMethod: string;
|
|
10
|
+
createdAt?: string;
|
|
11
|
+
}>;
|
|
12
|
+
/**
|
|
13
|
+
* Adds one detached JWS proof made by the already-unlocked professional
|
|
14
|
+
* profile. The browser never receives the private key or clear wallet seed.
|
|
15
|
+
*/
|
|
16
|
+
export declare function signOrganizationRegistrationAuthorizationCredential(input: SignOrganizationRegistrationAuthorizationInput): Promise<VerifiableCredentialV2>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { canonicalizeOrganizationRegistrationAuthorizationCredential, } from 'gdc-common-utils-ts/utils/organization-registration-authorization';
|
|
2
|
+
/**
|
|
3
|
+
* Adds one detached JWS proof made by the already-unlocked professional
|
|
4
|
+
* profile. The browser never receives the private key or clear wallet seed.
|
|
5
|
+
*/
|
|
6
|
+
export async function signOrganizationRegistrationAuthorizationCredential(input) {
|
|
7
|
+
if (!input.wallet.signDetachedJws) {
|
|
8
|
+
throw new Error('Wallet does not support detached organization authorization proofs.');
|
|
9
|
+
}
|
|
10
|
+
const verificationMethod = String(input.verificationMethod || '').trim();
|
|
11
|
+
if (!verificationMethod)
|
|
12
|
+
throw new Error('Organization authorization proof requires verificationMethod.');
|
|
13
|
+
const payload = canonicalizeOrganizationRegistrationAuthorizationCredential(input.credential);
|
|
14
|
+
const jws = await input.wallet.signDetachedJws(input.context, {
|
|
15
|
+
payload,
|
|
16
|
+
header: { typ: 'application/vc+ld+json' },
|
|
17
|
+
key: input.key,
|
|
18
|
+
});
|
|
19
|
+
const existingProofs = Array.isArray(input.credential.proof)
|
|
20
|
+
? input.credential.proof
|
|
21
|
+
: input.credential.proof
|
|
22
|
+
? [input.credential.proof]
|
|
23
|
+
: [];
|
|
24
|
+
return {
|
|
25
|
+
...input.credential,
|
|
26
|
+
proof: [...existingProofs, {
|
|
27
|
+
type: 'JsonWebSignature2020',
|
|
28
|
+
created: input.createdAt || new Date().toISOString(),
|
|
29
|
+
proofPurpose: 'contractAgreement',
|
|
30
|
+
verificationMethod,
|
|
31
|
+
jws,
|
|
32
|
+
}],
|
|
33
|
+
};
|
|
34
|
+
}
|