ceramic-cacao
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -13,3 +13,3 @@ "use strict"; | ||
statement: 'I accept the ServiceOrg Terms of Service: https://service.org/tos', | ||
uri: 'did:pkh:eip155:1:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', | ||
uri: 'did:key:z6MkrBdNdwUPnXDVD1DCxedzVVBpaGi8aSmoXFAeKNgtAer8', | ||
version: '1', | ||
@@ -16,0 +16,0 @@ nonce: '32891757', |
@@ -28,3 +28,3 @@ import * as multiformats from 'multiformats'; | ||
export declare type VerifyOptions = { | ||
atTime?: number | string; | ||
atTime?: number; | ||
}; | ||
@@ -31,0 +31,0 @@ export declare namespace Cacao { |
@@ -87,11 +87,3 @@ "use strict"; | ||
} | ||
let atTime = Date.now(); | ||
if (options.atTime) { | ||
if (typeof options.atTime === 'string') { | ||
atTime = Date.parse(options.atTime); | ||
} else { | ||
// Assuming options.atTime is a UNIX timestamp with seconds-precision | ||
atTime = options.atTime * 1000; | ||
} | ||
} | ||
const atTime = options.atTime ? options.atTime * 1000 : Date.now(); | ||
if (Date.parse(cacao.p.iat) > atTime || Date.parse(cacao.p.nbf) > atTime) { | ||
@@ -98,0 +90,0 @@ throw new Error(`CACAO is not valid yet`); |
@@ -32,5 +32,5 @@ "use strict"; | ||
nonce: cacao.p.nonce, | ||
issuedAt: new Date(cacao.p.iat).toISOString(), | ||
expirationTime: cacao.p.exp ? new Date(cacao.p.exp).toISOString() : undefined, | ||
notBefore: cacao.p.nbf ? new Date(cacao.p.nbf).toISOString() : undefined, | ||
issuedAt: cacao.p.iat, | ||
expirationTime: cacao.p.exp ? cacao.p.exp : undefined, | ||
notBefore: cacao.p.nbf ? cacao.p.nbf : undefined, | ||
requestId: cacao.p.requestId, | ||
@@ -37,0 +37,0 @@ chainId: new _caip.ChainId(account.chainId).reference, |
{ | ||
"name": "ceramic-cacao", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Typescript library for Ceramic OCAP", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
76069
774