|
|
@ -1316,17 +1316,29 @@ export async function createEndorserJwtVcFromClaim( |
|
|
|
return createEndorserJwtForDid(issuerDid, vcPayload); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Create a JWT for a RegisterAction claim. |
|
|
|
* |
|
|
|
* @param activeDid - The DID of the user creating the invite |
|
|
|
* @param contact - The contact to register, with a 'did' field (all optional for invites) |
|
|
|
* @param identifier - The identifier for the invite, usually random |
|
|
|
* @param expiresIn - The number of seconds until the invite expires |
|
|
|
* @returns The JWT for the RegisterAction claim |
|
|
|
*/ |
|
|
|
export async function createInviteJwt( |
|
|
|
activeDid: string, |
|
|
|
contact: Contact, |
|
|
|
contact?: Contact, |
|
|
|
identifier?: string, |
|
|
|
expiresIn?: number, // in seconds
|
|
|
|
): Promise<string> { |
|
|
|
const vcClaim: RegisterVerifiableCredential = { |
|
|
|
"@context": SCHEMA_ORG_CONTEXT, |
|
|
|
"@type": "RegisterAction", |
|
|
|
agent: { identifier: activeDid }, |
|
|
|
object: SERVICE_ID, |
|
|
|
identifier: identifier, |
|
|
|
}; |
|
|
|
if (contact) { |
|
|
|
if (contact?.did) { |
|
|
|
vcClaim.participant = { identifier: contact.did }; |
|
|
|
} |
|
|
|
|
|
|
@ -1341,7 +1353,7 @@ export async function createInviteJwt( |
|
|
|
}; |
|
|
|
|
|
|
|
// Create a signature using private key of identity
|
|
|
|
const vcJwt = await createEndorserJwtForDid(activeDid, vcPayload); |
|
|
|
const vcJwt = await createEndorserJwtForDid(activeDid, vcPayload, expiresIn); |
|
|
|
return vcJwt; |
|
|
|
} |
|
|
|
|
|
|
|