Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert on verificationMethod "contents of the value MUST be expressed with a header and encoding" #66

Open
2 tasks
aljones15 opened this issue Jul 16, 2024 · 0 comments

Comments

@aljones15
Copy link
Contributor

aljones15 commented Jul 16, 2024

We need something like this in assertions:

https://github.com/w3c/vc-di-bbs-test-suite/blob/9cd1d21dbaa076da43149f1dd2366c7d28c46c3a/tests/assertions.js#L135-L167

proofValue (this statement concerns verificationMethod)
A string value that contains the base-encoded binary data necessary to verify the digital proof using the verificationMethod specified. The contents of the value MUST be expressed with a header and encoding as described in Section 2.4 Multibase of the Controller Documents 1.0 specification

export function expectedMultibasePrefix(cryptosuite) {
const b64urlNoPadSuites = ['ecdsa-sd-2023', 'bbs-2023'];
if(b64urlNoPadSuites.includes(cryptosuite)) {
return {
prefix: 'u',
name: 'base64url-no-pad'
};
}
return {
prefix: 'z',
name: 'base58btc'
};
}

export function isValidMultibaseEncoded(rawValue, multibasePrefix) {
switch(multibasePrefix) {
case 'z':
return shouldBeBs58(rawValue);
case 'u':
return shouldBeBase64NoPadUrl(rawValue);
default:
throw new Error(`Unhandled encoding prefix: ${multibasePrefix}.`);
}
}

@aljones15 aljones15 changed the title assert on proofValue assert on proofValue "contents of the value MUST be expressed with a header and encoding" Jul 16, 2024
@aljones15 aljones15 changed the title assert on proofValue "contents of the value MUST be expressed with a header and encoding" assert on verificationMethod "contents of the value MUST be expressed with a header and encoding" Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant