mirror of
https://github.com/BillionsNetwork/verified-agent-identity.git
synced 2026-09-14 14:27:14 +08:00
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
const { CircuitId } = require("@0xpolygonid/js-sdk");
|
|
const { computeAttestationHash } = require("./attestation");
|
|
const { buildEthereumAddressFromDid } = require("./utils");
|
|
const {
|
|
nullifierSessionId,
|
|
pouScopeId,
|
|
pouAllowedIssuer,
|
|
authScopeId,
|
|
pouCredentialContext,
|
|
} = require("./constants");
|
|
|
|
function createPOUScope(transactionSender) {
|
|
return {
|
|
id: pouScopeId,
|
|
circuitId: CircuitId.AtomicQueryV3OnChainStable,
|
|
params: {
|
|
sender: transactionSender,
|
|
nullifierSessionId: nullifierSessionId,
|
|
},
|
|
query: {
|
|
allowedIssuers: pouAllowedIssuer,
|
|
type: "UniquenessCredential",
|
|
context: pouCredentialContext,
|
|
},
|
|
};
|
|
}
|
|
|
|
function createAuthScope(recipientDid) {
|
|
return {
|
|
id: authScopeId,
|
|
circuitId: CircuitId.AuthV3_8_32,
|
|
params: {
|
|
challenge: computeAttestationHash({
|
|
recipientDid: recipientDid,
|
|
recipientEthAddress: buildEthereumAddressFromDid(recipientDid),
|
|
}),
|
|
},
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
createPOUScope,
|
|
createAuthScope,
|
|
};
|