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

feat!: add support for VerifiableURI and deprecate JSONURL / AssetURL #365

Merged
merged 11 commits into from
Dec 14, 2023
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,23 @@ export class ERC725 {
// eslint-disable-next-line class-methods-use-this
private validateSchemas(schemas: ERC725JSONSchema[]) {
return schemas.filter((schema) => {
if (
schema.valueContent === 'AssetURL' ||
schema.valueContent === 'JSONURL'
) {
console.warn(
`[Deprecation notice] The schema with keyName: ${schema.name} uses deprecated valueContent: ${schema.valueContent}. It has been replaced by VerifiableURI. Decoding is backward compatible but value will be encoded as VerifiableURI.`,
);
Hugoo marked this conversation as resolved.
Show resolved Hide resolved
}

try {
const encodedKeyName = encodeKeyName(schema.name);

const isKeyValid = schema.key === encodedKeyName;

if (!isKeyValid) {
console.log(
Hugoo marked this conversation as resolved.
Show resolved Hide resolved
`The schema with keyName: ${schema.key} is skipped because its key hash does not match its key name (expected: ${encodedKeyName}, got: ${schema.key}).`,
`The schema with keyName: ${schema.name} is skipped because its key hash does not match its key name (expected: ${encodedKeyName}, got: ${schema.key}).`,
);
}

Expand Down