Skip to content

Commit

Permalink
Add copyrights, change test to https, change helper.js name
Browse files Browse the repository at this point in the history
  • Loading branch information
wes-smith committed Feb 5, 2024
1 parent 73718df commit 9caa12a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
7 changes: 5 additions & 2 deletions lib/create.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
/*!
* Copyright (c) 2024 Digital Bazaar, Inc. All rights reserved.
*/
import {createHasher, hashCanonizedProof, stringToUtf8Bytes}
from '@digitalbazaar/di-sd-primitives';
import {canonize} from './canonize.js';
import {concat} from './helper.js';
import {concat} from './helpers.js';
import {createVerifier} from './createVerifier.js';
import {name} from './name.js';
import {requiredAlgorithm} from './requiredAlgorithm.js';
Expand All @@ -21,7 +24,7 @@ export function createCryptosuite({extraInformation = new Uint8Array()} = {}) {
async function _createSignData({cryptosuite, document, proof, documentLoader}) {
const options = {documentLoader};

//create hash from extraInformation
//create hash from `extraInformation`
const hasher = createHasher();
const externalHash = await hasher.hash(cryptosuite.options.extraInformation);

Expand Down
3 changes: 3 additions & 0 deletions lib/helper.js → lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*!
* Copyright (c) 2024 Digital Bazaar, Inc. All rights reserved.
*/
export function concat(b1, b2) {
const rval = new Uint8Array(b1.length + b2.length);
rval.set(b1, 0);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"lib/**/*.js"
],
"dependencies": {
"@digitalbazaar/cborld": "^6.0.3",
"@digitalbazaar/di-sd-primitives": "^3.0.0",
"@digitalbazaar/ecdsa-multikey": "^1.6.0",
"jsonld": "^8.3.2"
Expand Down
10 changes: 5 additions & 5 deletions test/EcdsaXi2023Cryptosuite.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ describe('EcdsaXi2023Cryptosuite', () => {
expect(error).to.not.exist;
expect(result).to.exist;
/* eslint-disable max-len */
const expectedResult = `<http://example.edu/credentials/1872> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org#AlumniCredential> .
<http://example.edu/credentials/1872> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> .
<http://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#credentialSubject> <https://example.edu/students/alice> .
<http://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#issuanceDate> "2010-01-01T19:23:24Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<http://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#issuer> <https://example.edu/issuers/565049> .
const expectedResult = `<https://example.edu/credentials/1872> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://schema.org#AlumniCredential> .
<https://example.edu/credentials/1872> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://www.w3.org/2018/credentials#VerifiableCredential> .
<https://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#credentialSubject> <https://example.edu/students/alice> .
<https://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#issuanceDate> "2010-01-01T19:23:24Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
<https://example.edu/credentials/1872> <https://www.w3.org/2018/credentials#issuer> <https://example.edu/issuers/565049> .
<https://example.edu/students/alice> <https://schema.org#alumniOf> "Example University" .\n`;
/* eslint-enable max-len */
result.should.equal(expectedResult);
Expand Down
2 changes: 1 addition & 1 deletion test/mock-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const credential = {
},
'https://w3id.org/security/data-integrity/v2'
],
id: 'http://example.edu/credentials/1872',
id: 'https://example.edu/credentials/1872',
type: ['VerifiableCredential', 'AlumniCredential'],
issuer: 'https://example.edu/issuers/565049',
issuanceDate: '2010-01-01T19:23:24Z',
Expand Down

0 comments on commit 9caa12a

Please sign in to comment.